<?php


use yii\bootstrap\BootstrapAsset;
use yii\helpers\Url;
use common\models\business\BusinessInspection;
use common\models\business\BusinessFarmers;
BootstrapAsset::register($this);
use common\models\business\BusinessContractStatements;
use common\models\business\BusinessContractPurchase;
use common\models\business\BusinessContract;
use common\models\business\BusinessContractAdjustment;


$jiesuan = (new \yii\db\Query())->select('*')->from(BusinessContractStatements::tableName())->where('contract_id=:contract_id',[':contract_id'=>$model->id])->all();


//$goujin = (new \yii\db\Query())->select('*')->from(BusinessContractPurchase::tableName())->where('contract_id=:contract_id',[':contract_id'=>$model->id])->all();
//$tiaozheng = (new \yii\db\Query())->select('*')->from(BusinessContractAdjustment::tableName())->where('contractid=:contract_id',[':contract_id'=>$model->id])->all();



?>




<div class="row">
    <div class="col-md-12">
        <h3>结算单</h3>
        <table class="table table-hover">
            <tr>
                <th>单号</th>
                <th>执单人</a></th>
                <th>执单时间</th>
                <th>结算数量</th>
                <th>结算金额</th>
                <th>付款情况</th>
                <th>审核人</th>
                <th>审核时间</th>
                <th>操作</th>
            </tr>
            <?php foreach ($jiesuan as $key => $row){ ?>
            <tr>
                <td><?=$row['number']?></td>
                <td><?=$row['inputuser']?></td>
                <td><?=date('Y-m-d H:i:s',$row['inputtime'])?></td>
                <td><?= $row['num'] ?></td>
                <td><?= $row['price'] ?></td>
                <td><?= BusinessContractStatements::$pays[$row['ispay']] ?></td>
                <td><?=$row['agreeuser']?$row['agreeuser']:'待审核'?></td>
                <td><?=$row['agreetime']?date('Y-m-d H:i:s',$row['agreetime']):'待审核'?></td>
                <td><a href="<?= Url::to(['/business/contract-statements/view','id'=>$row['id']]) ?>">查看</a></td>
            </tr>
            <?php } ?>
        </table>
    </div>
</div>